/**
 * @description: 「主持风采」模块相关接口
 * @author: Ruan Jiazhen
 * @date: 2024-03-08 10:32:10
 **/
import http from '@/utils/request';

export const reqGetProfile = () => {
  return http.$get<HostingStyleProfileRes>('hostStyle/getInfo');
};

/**
 * @description： 获取默认的标签列表
 */
export const reqGetDefaultTags = () => {
  return http.$get<Array<string>>('hostStyle/getSignList');
};

/**
 * @description: 编辑资料
 * @param {object} data
 */
export const reqUpdateProfile = (data: UpdateProfileReq) => http.$post('hostStyle/editInfo', data);

/**
 * @description: 发布作品
 * @param data
 */
export const reqPublishWork = (data: { title: string; cover: string; content: string; imageList?: string[]; video?: string }) =>
  http.$post<null>('hostStyle/saveWorks', {
    ...data,
    imageList: JSON.stringify(data.imageList || []),
    video: data.video || '',
  });

/**
 * @description: 获取作品列表
 * @param page 页码
 * @param pageSize 每页条数
 */
export const reqGetWorkList = (page: number, pageSize: number) =>
  http.$get<GetWorkListResData>('hostStyle/worksList', {
    currentPage: page,
    showCount: pageSize,
  });

/**
 * @description: 点赞作品
 * @param find_id 作品id
 */
export const reqLikeWork = (find_id: number) => http.$post('hostStyle/likeWorks', { find_id });

/**
 * @description: 获取作品详情
 * @param find_id 作品id
 */
export const reqGetWorkDetail = (find_id: number) => http.$get<GetWorkDetailResData>('hostStyle/getWorksDetail', { find_id });

/**
 * @description: 删除作品
 * @param find_id 作品id
 */
export const reqDeleteWork = (find_id: number) => http.$post('hostStyle/removeWorks', { find_id });

/**
 * @description: 增加作品点击量
 * @param find_id 作品id
 */
export const reqRecordWorkClick = (find_id: number) => http.$post('hostStyle/recordWorksClickCount', { find_id });

/**
 * @description: 添加档期
 */
export const reqAddSchedule = (data: CreateScheduleReq) =>
  http.$post('schedule/save', {
    ...data,
    kind: '1',
    type: '1',
  });

/**
 * @description: 获取档期详情
 */
export const reqGetScheduleDetail = (schedule_id: string) =>
  http.$get<
    CreateScheduleReq & {
      kind: '1';
      type: '1';
    }
  >('schedule/getScheduleData', { schedule_id });

/**
 * @description: 删除档期
 */
export const reqDeleteSchedule = (schedule_id: string) => http.$post('schedule/editScheduleData', { schedule_id, is_delete: '1' });

/**
 * @description: 编辑档期
 */
export const reqEditSchedule = (schedule_id: string, data: CreateScheduleReq) =>
  http.$post('schedule/editScheduleData', {
    ...data,
    schedule_id,
    is_delete: '0',
  });
